#include "Utilities.h"

vector<int> delta(Direction direction)
{
	int delta_x = 0;
	int delta_y = 0;

	switch(direction)
	{
		case UP:	delta_y = -1;	break;
		case DOWN:	delta_y = +1;	break;		
		case LEFT:	delta_x = -1;	break;		
		case RIGHT:	delta_x = +1;	break;
	}
	
	vector<int> delta;
	delta.push_back(delta_x);
	delta.push_back(delta_y);

	return delta;
}

bool contains(vector<Direction> list, Direction value)
{
	for(int i = 0; i < list.size(); i++)
	{
		if(list.at(i) == value)
			return true;
	}
	return false;
}


double diffclock(clock_t clock1,clock_t clock2)
{
	double diffticks=clock1-clock2;
	double diffms=(diffticks*1000)/CLOCKS_PER_SEC;
	return diffms;
}

float directionToAngle(Direction dir)
{
	float angle = 0;
	const float pi = 3.14;
		switch(dir)
		{
		case UP:	angle = pi*3/2;	break;
		case DOWN:	angle = pi*1/2;	break;
		case LEFT:	angle = pi;		break;
		case RIGHT:	angle = 0;		break;
		}

	return angle;
}